;;; Copyright (c) 1999 Massachusetts Institute of Technology
;;;
;;; This program is free software; you can redistribute it and/or
;;; modify it under the terms of the GNU General Public License as
;;; published by the Free Software Foundation; either version 3 of the
;;; License, or (at your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
;;; General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this program; if not, see https://gnu.org/licenses or
;;; write to:
;;;  Free Software Foundatiom, Inc.
;;;  51 Franklin St, Fifth Floor
;;;  Boston, MA 02110-1301
;;;  USA

;channel header pointer (location 40, read only)
;
;	ADDRESS(channel header area)
;	ADDRESS(pointer area)
;	I/O version number
;	source file version number
;	0	always 0
;	INITED	non-zero indicates PDP-11 is running ok(can be cleared by PDP-10)
;	0	always 0
;	GDOWN	used as flag by PDP-10 to acknowledge clear of INITED
;
;channel header area (aligned on PDP-10 word)
;
;    KBD channel:
;	KBDFLG	cleared by 10/set by 11 (chain of activated KBD buffers)
;	0	allows PDP-10 to do SKIPN for activation test
;    DPY channel: (1 per console)
;	DPYCHN	buffer assigned to channel, if zero then DPY channel is closed
;	DPYKBD	.BYTE KBD#, DPY# (377 for either implies not assigned)
;    KBD flags: (1 per console)
;	ECOFLG	Set by PDP-10.  Next time DPYBUF is empty clear ECOFLG
;		and put flag on KBD ring to signal this condition
;	CHNCLS	if -1, log this guy out!!!!
;    WHO flags: (1 per console)
;	WHOLIN	who line variables for this console
;	WHOUSR	-1=>do system line, 0=>user who line
;
;format of KBD buffer (aligned on PDP-10 word)
;
;	KBDSTS	negative=>-(data byte count), 0=>free
;	0
;	KBDRNG	next KBD buffer associated with this KBD
;	KBDLST	next buffer on activated list (0=>end of chain)
;	KBDCHN	keyboard channel
;	0	not used
;	KBDATA	key board data area (1 PDP-11 word/character)
;
;format of DPY buffer (aligned on PDP-10 word)
;
;	DPY10B	word PDP-10 is hacking (used only for initailization)
;	DPY11B	word PDP-11 is hacking
;	DPYPP	page printer variables
;	DPYLGL	last legal address in this buffer
;	DPYSIZ	size of data area in bytes
;	0	not used
;	DPYATA	display data area (1 PDP-11 word/character)
;
;format of pointer area (aligned on PDP-10 word)
;
;	ADDRESS(system who line variables)
;	ADDRESS(PDP-10/PDP-11 communication area)
;	TENWHO (SET TO -1 WHENEVER ANYONE TYPES WHO LINE COMMAND, RESET TO 0 WHEN 10
;		UPDATES WHO LINES
;	TENWH1  PADDING
;
;Notes:
;
;1.	All addresses and pointers are in PDP-11 address space.
;
;2.	KBD buffers are ringed two per channel.  While the PDP-10 is
;	emptying one, the PDP-11 can fill the other.
;
;3.	There is only one DPY buffer per channel.  When the buffer is filled
;	with negative numbers, it is free.  When the PDP-10 writes a positive
;	number in the current word: then the PDP-11 processes the data in that
;	word, sets that word to a negative number, and advances to the next word.
;WHO LINE VARIABLES
;
;SYSTEM WHO LINE  (one PDP-11 word/line unless otherwise indicated)
;    ITSTCH	# total # 10/11 dpy channels (read only for PDP-10)
;    ITSCHN	# 10/11 dpy channels in use (read only for PDP-10)
;    ITSVER	ITS version #
;    ITSJOB	total jobs
;    ITSCOR	total core
;    ITSRU	runnable users
;    ITSWBJ	# jobs swap blocked
;    ITSJWP	# jobs waiting for pages
;    ITSTRC	total runable core
;    ITSCFU	core available for users
;    ITSDAT	date [byte (7) year (4) month (5) day]
;    ITSDBG	system debug flag
;    ITSTIM	time of day (# half seconds since midnight) aligned on PDP-10 word
;    ITSTI1	low order of time
;    ITSUSR	total number of users
;
;USER WHO LINE (One PDP-11 word per line unless otherwise noted)
     WHJOB==0	;job #, -1=>who line not in use
;    WHJOB1	;pads WHJOB
     WHMODE==1	;mode	0=>follow keyboard
;			1=>freeze
;			2=>next higher (when PDP-10 sees this state, it searches
;			   user variables for next higher job index number with same
;			   uname.  When it finds it, it stores the number in job #
;			   and changes mode to 1
;			3=>next lower
;    WHMOD1	;pads WHMODE
     WHUNAM==2	;uname in sixbit (left 18 bits in first two words, right in next two)
;    WHUNM1
     WHUNM2==3
;    WHUNM3
     WHJNAM==4	;jname in sixbit
;    WHJNM1
     WHJNM2==5
;    WHJNM3
     WHSNAM==6	;sname in sixbit
;    WHSNM1
     WHSNM2==7
;    WHSNM3
     WHSTAT==10	;status in sixbit, 0=>job does not exist
;    WHSTA1
     WHSTA2==11
;    WHSTA3
     WHJ%RT==12	;job % run time
;    WHJTRT	job total run time (one millisec units)
;    WHRPAG	job number of pages real mem assigned
;    WHPAG	job number of pages virtual mem assigned
;    WHO1	user who line control word
;    WHO1A
;    WHO2	first user who line variable
;    WHO2A
;    WHO2B
;    WHO2C
;    WHO3	second user who line variable
;    WHO3A
;    WHO3B
;    WHO3C
;
;
;NOTE:	The PDP-11 will not update who lines until it sees that ITSTIM
;	has changed.
;
;PDP-10/PDP-11 COMMAND CHANNEL
;
;    CMDFLG	aligned on PDP-10
;		0=>buffer is free (PDP-10 can write CMDBUF)
;		positive=>command # from PDP-10 (PDP-11 can write CMDBUF)
;		negative=>affirmative reply from PDP-11 (0=>command failed)
;		PDP-10 can read CMDBUF, then must zero CMDFLG
;    CMDFL1	always 0
;    CMDBUF	each arg takes 4 bytes (1 PDP-10 word)
;
;    PDP-10/PDP-11 COMMANDS
;
;	1	video switch
;		arg1:	video switch input #  (set by PDP-10)
;		arg2:	video switch output # ( "  "   "  " )
;
;	2	reserve DPY
;		arg1:	DPY reserved (set by PDP-11)
;
;	3	free DPY
;		arg1:	DPY to free (set by PDP-10)
;
;;other 10-11 commuincation issues ..
;
;;go down resetting video switch vs not
;;PDP-11 indicates it has reset video switch
;	;(PDP-10 then detaches all jobs with tv ttys)
